<template>
	<view class="manhua_content" @click="go_manhua_detail">
		<view class="item_container">
			<view class="item_img">
				<image :src="api + manhua.cartoonImg" style="width: 100px;height: 125px;" mode="aspectFit"></image>
			</view>
			<view class="item_text">
				<view class="title">{{manhua.cartoonName}}</view>
				<!-- <p class="jianjie">{{manhua.description}}</p> -->
			</view>
		</view>
	</view>
</template>

<script>
	import api from '../api/config.js'
	export default {
		data() {
			return {
				api: api
			}
		},
		props: {
			manhua: {
				typeof: Object,
			}
		},
		onLoad() {
	
		},
		methods: {
			go_manhua_detail() {
				// 增加浏览历史
				let now_time = (new Date(Date.now())).toLocaleString()
				uni.request({
					url:api + '/mobile_add_history/',
					method:'POST',
					data:{
						username: uni.getStorageSync('mobile'),
						cartoonName: this.manhua.cartoonName,
						cartoonImg: '/static/cartoon_resources/'+this.manhua.cartoonName+'/'+this.manhua.cartoonName+'.jpg',
						readTime: now_time,
					}
				})
				uni.navigateTo({
					url:'/pages/manhua/manhua?cartoonName=' + this.manhua.cartoonName
				})
			}
		}
	}
</script>

<style>
	.item_container{
		height: 160px;
		width: 100px;
		padding: 5px;
	}
	.item_img{
		width: 100px;
		height: 125px;
	}
	.item_text{
		text-align: left;
		margin-top: 10px;
	}
	.title{
		font-size: 15px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.jianjie{
		font-size: 12px;
		color: gray;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
</style>